﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Tools {
    public class StreamRange {
        protected UInt64 begin;
        protected UInt64 end;



        public StreamRange ( ) {

        }

        public UInt64 Begin {
            set {
                if ( value > this.end ) {
                    throw new Exception( "stream BEGIN must be less than END" );
                }
                this.end = value;
            }
            get {
                return this.begin;
            }
        }
        public UInt64 End {
            set {
                if ( value < this.begin ) {
                    throw new Exception( "stream END must be grater than BEGIN" );
                }
                this.end = value;
            }
            get {
                return this.end;
            }
        }

        public UInt64 Length {
            set {
                this.End = this.Begin + value;
            }
            get {
                return this.end - this.begin;
            }
        }
    }
}
